<div class="row">
  <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>

<div class="alert span7" style=" margin-top:10px;">
  <strong>说明：</strong> 此功能用于清除在分数据库但不在总数据库中的孩子
</div>

    <*if $item.info neq ''*>
    <div class="span7" >
<form action="/<*$controller*>/opstudentnocentral" method="post" onsubmit="return checkhtml();"  id="f1" >    
   <table cellpadding="0" cellspacing="0" class="table">
		<tr> 
            <th class="span1">groupid</th>
            <th class="span3">所在机构</th>
            <th class="span2">学生id</th>
			<th class="span2">姓名</th>
			<th class="span2"><input type="checkbox" title="全选" name="qxhtml" id="qxhtml" style="background:none" value="1" onclick="xuanhtml();"/></th>
			<th>&nbsp;</th>
		</tr>
      
    	<*foreach from=$result item=item key =key name=foo*>
    	<*foreach from=$item.info item=a key =k name=f*>
        <tr <*if $a.uid eq 0*>style="color:#F00"<*/if*>> 
            <td><*$item.groupid*></td>
			<td><*$item.groupname*></td>
			<td><*$a.studentid*></td>
			<td><*$a.cnname*></td>
			<td><label><input type="checkbox" style="float:left;background:none" onclick="checkedov(<*$a.uid*>)" name="htmlid[]" id="<*$a.studentid*>" value="<*$a.studentid*>" /></label>	
            <input type="hidden" name="groupid[<*$a.studentid*>]" id="groupid" value="<*$item.groupid*>"/>            
            </td>
            <td>&nbsp;</td>
		</tr> 
		<*/foreach*>
		<*/foreach*>
         <tr><th colspan="6"><button type="submit" class="btn-large btn-primary span6" >删除</button></th></tr>
    </table>
	<input type="hidden" name="ischecked" id="ischecked" value="0"/>
    </div>
    <*else*>
    <div class="alert alert-info span7" style="margin-left:330px; margin-top:10px;">
    	<strong></strong> 没有脏数据！
    </div>
    <*/if*>	 
    
</div>
</div>
<script type="text/javascript">  
function checkhtml(){
	var checkboxs=document.getElementsByName("htmlid[]");
	var clength=checkboxs.length;
	var isc=0;
	for (var i=0;i<clength;i++) {
		var e=checkboxs[i].value;
		var es=document.getElementById(e);
		if(es.checked==true){
			isc=1;
		}
	}
	if(isc==0){
		alert('请选择！');
		return false;
	}
	return true;
}

function checkedov(id){
	var ischecked=document.getElementById("ischecked");
	var ids=document.getElementById(id);
	if(ids.checked==true){
		ischecked.value=1;
	}
}

function xuanhtml() {
	var qxhtml=document.getElementById("qxhtml");
	var checkboxs=document.getElementsByName("htmlid[]");
	var ischecked=document.getElementById("ischecked");
	if(qxhtml.checked==true){
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=true;
		}
		ischecked.value=1;
	}else{
		for (var i=0;i<checkboxs.length;i++) {
			var e=checkboxs[i];
			e.checked=false;
		}
		ischecked.value=0;
	}
}

</script>
